#include "player.h"

Player::Player()
{
    level = 1;     // 初始等级      1
    hp = 1000;     // 初始生命值  1000
    attack = 10;   // 初始攻击力    10
    defend = 10;   // 初始防御力    10
    money = 0;     // 初始金钱      0
    exp = 0;       // 初始经验值    0
    ykey = 0;      // 初始黄钥匙数   0
    bkey = 0;      // 初始蓝钥匙数   0
    rkey = 0;      // 初始红钥匙数   0
    toward = 3;    // 初始朝向
    posX = 5;      // 初始 X坐标
    posY = 9;      // 初始 Y坐标
}

Player::~Player()
{

}

QPixmap *Player::getPixMap()
{
        //0-左 1-下 2-右 3-上
    if (toward == 0)//左
        return data->playerImgMap[-1];
    if (toward == 1)//下
        return data->playerImgMap[-2];
    if (toward == 2)//右
        return data->playerImgMap[-3];;
    if (toward == 3)//上
        return data->playerImgMap[-4];;
    return NULL;
}

void Player::move(int cx, int cy) {
    this->posX = cx;
    this->posY = cy;
}


int Player::getLevel() const
{
    return level;
}

void Player::setLevel(int value)
{
    level = value;
}

int Player::getHp() const
{
    return hp;
}

void Player::setHp(int value)
{
    hp = value;
}

int Player::getAttack() const
{
    return attack;
}

void Player::setAttack(int value)
{
    attack = value;
}

int Player::getDefend() const
{
    return defend;
}

void Player::setDefend(int value)
{
    defend = value;
}

int Player::getMoney() const
{
    return money;
}

void Player::setMoney(int value)
{
    money = value;
}

int Player::getExp() const
{
    return exp;
}

void Player::setExp(int value)
{
    exp = value;
}

int Player::getYkey() const
{
    return ykey;
}

void Player::setYkey(int value)
{
    ykey = value;
}

int Player::getBkey() const
{
    return bkey;
}

void Player::setBkey(int value)
{
    bkey = value;
}

int Player::getRkey() const
{
    return rkey;
}

void Player::setRkey(int value)
{
    rkey = value;
}

int Player::getToward() const
{
    return toward;
}

void Player::setToward(int value)
{
    toward = value;
}

int Player::getPosX() const
{
    return posX;
}

void Player::setPosX(int value)
{
    posX = value;
}

int Player::getPosY() const
{
    return posY;
}

void Player::setPosY(int value)
{
    posY = value;
}
